import java.util.Scanner ; 
 

public class NombreParfait { 

    public static boolean nbrParfait (int nbr1) {

	int cpt, total;
	cpt = 1 ;
	total = 0;

	while (cpt<nbr1) {

		if (nbr1%cpt == 0) {

			total = total + cpt;

		}

		cpt = cpt + 1;

	}

	return total == nbr1;

    }




    public static void main ( String[] args ) { 

	int nbr1;
	boolean ok;
	Scanner clavier = new Scanner ( System.in ) ;  
	nbr1 = clavier.nextInt();
	ok = nbrParfait(nbr1);
	System.out.println(ok);

    }

}
